home *** CD-ROM | disk | FTP | other *** search
/ AI Game Programming Wisdom / AIGameProgrammingWisdom.iso / SourceCode / 11 Learning / 04 Mommersteeg / Tennis / RandomPredictor.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-09-23  |  1.8 KB  |  45 lines

  1. //----------------------------------------------------------------------------------------------
  2. // Sequential Prediction Demo: The positioning pattern
  3. // 
  4. // Author:  Fri Mommersteeg
  5. // Date:    10-09-2001
  6. // File:    RandomPredictor.h
  7. //----------------------------------------------------------------------------------------------
  8.  
  9. //----------------------------------------------------------------------------------------------
  10. //    The random predictor is just a random number generator for a specified domain.
  11. //    It uses the standard C function rand() to generate a pseudo random number.
  12. //----------------------------------------------------------------------------------------------
  13.  
  14. #ifndef __RANDOMPREDICTOR_H
  15. #define __RANDOMPREDICTOR_H
  16.  
  17. //----------------------------------------------------------------------------------------------
  18. // Include files
  19. //----------------------------------------------------------------------------------------------
  20.  
  21. #include "predictor.h"
  22.  
  23. //----------------------------------------------------------------------------------------------
  24. // CRandomPredictor: Randomly predicts the next element in the sequence
  25. //----------------------------------------------------------------------------------------------
  26.  
  27. class CRandomPredictor : CPredictor {
  28. public:
  29.  
  30.     // implementation of interface CPredictor
  31.     virtual void    Update(int NextElement) { /* just ignore updates */ }
  32.     virtual bool    GetPrediction(int &Prediction);
  33.     virtual void    Reset() { /* just ignore resets */ }
  34.  
  35.     // setup method
  36.     virtual void    Setup(int nAlphabetSize, unsigned int nSeed = 0);
  37.  
  38. protected:
  39.     unsigned int    m_nAlphabetSize;
  40.  
  41. };
  42.  
  43. //----------------------------------------------------------------------------------------------
  44. #endif // __RANDOMPREDICTOR_H
  45.